package com.zuxia.impservices;

import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONArray;
import com.zuxia.iDao.AdmininfoDAOI;
import com.zuxia.iDao.StaffindoDAOI;
import com.zuxia.impDao.AdmininfoDAO;
import com.zuxia.iservices.ChangeServicesI;

public class ChangeServices implements ChangeServicesI {
	//创建私有化Dao
	private AdmininfoDAOI admininfoDAO;
	private StaffindoDAOI staffindoDAO;

	public StaffindoDAOI getStaffindoDAO() {
		return staffindoDAO;
	}

	public void setStaffindoDAO(StaffindoDAOI staffindoDAO) {
		this.staffindoDAO = staffindoDAO;
	}

	public AdmininfoDAOI getAdmininfoDAO() {
		return admininfoDAO;
	}

	public void setAdmininfoDAO(AdmininfoDAOI admininfoDAO) {
		this.admininfoDAO = admininfoDAO;
	}


	public Boolean userShowPwd(String user, String pwd) {
		Boolean b=staffindoDAO.userShowPwd(user, pwd);
		if(b==false)
		{
			return admininfoDAO.userShowPwd(user, pwd);
		}
		return b;
	}

	public Boolean userUpdatePwd(String user, String pwd, String xpwd) {
		if(staffindoDAO.userShowPwd(user, pwd))
		{
			return staffindoDAO.userUpdatePwd(user, pwd, xpwd);
		}else{
			return admininfoDAO.userUpdatePwd(user, pwd, xpwd);
		}
	}

	public String userSelect(int id) {
		List listAdminInfo = admininfoDAO.userSelect(id);
		String json = JSONArray.toJSONString(listAdminInfo);
		return json;
	}

}
